<?php
class announcement_view extends SClass {

    public function process() {
        $user = $this->getUserSecure();
        if ($user) {
            if ($user->getLevel() >= 2) {
        	   $this->assign('autorized', 1);
            }
        }
        $iii=1;
        $post = ServiceUtils::GetFactory()->getAnnouncementService()->getAnnouncementAll();
        $a = array();
        while ($x = $post->getNext()) {
            if ($iii==1){
                $color="#ededed";
                $iii=0;
            }
            else{
                $iii=1;
                $color="#f5f5f5";
                }
            $a[] = array(
                'id' => $x->getId(),
                'colorBec'=>$color,
                'title' => $x->getTitle(),
                'preview' => $x->getPreview(),
                'postdate' => $x->getPostdate(),
                'url' => Engine_LinkMaker::GetURLByContentID(
                    'announcement_post_view', $x->getId()),
                'urledit' => Engine_LinkMaker::GetURLByContentID(
                    'announcement_post_edit', $x->getId()),
                'urldelete' => Engine_LinkMaker::GetURLByContentID(
                    'announcement_post_delete', $x->getId())
            );
            
        }
        $this->assign('postArray', $a);
    }

}//ededed